package com.wanmait.movie.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wanmait.movie.entity.Participating;
import com.wanmait.movie.entity.VO.ParticipatingDTO;
import com.wanmait.movie.mapper.ParticipatingMapper;
import com.wanmait.movie.service.ParticipatingService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional(rollbackFor = Exception.class)
public class ParticipatingServiceImpl extends ServiceImpl<ParticipatingMapper, Participating> implements ParticipatingService {
    @Resource
    private ParticipatingMapper participatingMapper;

    @Override
    public List<Participating> getParticipatingByMovieId(Integer movieId) {
        LambdaQueryWrapper<Participating> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Participating::getMovieId, movieId);
        return participatingMapper.selectList(queryWrapper);
    }
}
